﻿function chkall(e){
    var chklist = document.getElementsByTagName('INPUT');
    for (var i = 0; i < chklist.length; i++) {
        if (chklist[i].type == 'checkbox' && chklist[i].id.indexOf('chkitem') > -1) { 
                     document.getElementById(chklist[i].id).checked  = e.checked;
                }
            }
        }
var chkcount = 0;

function modi(){
    mathcount();
    if(chkcount == 0)
    {
        alert('请至少选择一项！');
        return false;
    }
    else if(chkcount >1)
    {
         alert('只能选择一项！');
         return false;
     }
}

function del(){
    return msgbox('删除');
 }

function msgbox(txt)
{
    mathcount();
    if(chkcount ==0)
    { alert('请至少选择一项！');
        return false;
     }
     else
     {
        if (!confirm('是否确定'+ txt +'？'))
        {
            return false;
        }
     }
}

function check() {
    mathcount();
    if (chkcount == 0)
    { alert('请至少选择一项！'); return false; }
}
function mathcount()
{
    chkcount=0;
    var chklist = document.getElementsByTagName('INPUT');
    for(var i=0;i<chklist.length;i++)
        {
            if (chklist[i].type == 'checkbox' && chklist[i].id.indexOf('chkitem') > -1)
                {
                     if(document.getElementById(chklist[i].id).checked){
                        chkcount = chkcount+1;
                     }
                }
        }
    }


    
    function GridViewMouseover(grdTr) {
        if (grdTr.className == 'seldgvitem') {
            return;
        }
        else {
            grdTr.className = 'overdgvitem';
        }   
    }
    function GridViewMouseout(grdTr) {
        if (grdTr.className == 'seldgvitem') {
            return;
        }

        else if (grdTr.className == 'overdgvitem') {
        if (grdTr.rowIndex % 2 == 1) {
                grdTr.className = 'dgvitem';
            }
            else {
                grdTr.className = 'dgvitem1';
             }
        }
                       
    }

    function GridViewonclick(row) {
        if (row.cells[0].children[0].checked == false) {

            row.className = 'seldgvitem';
        }
        
        else {           
            if (row.rowIndex % 2 == 1) {
                row.className = 'dgvitem';
            }
            else row.className = 'dgvitem1';
        }
        if (row.cells[0].children[0].checked == false) row.cells[0].children[0].checked = true;
        else row.cells[0].children[0].checked = false; 
    }



    function chkclick(chk) {      
        if (chk.checked == true) chk.checked = false;
        else chk.checked = true; 
    }
